<?php

namespace app\controller;

use app\BaseController;
use app\service\LoginService;
use app\service\RegionService;
use app\utils\CaptchaUtils;
use app\validate\LoginValidate;
use think\exception\ValidateException;
use \think\facade\Request;
use think\captcha\facade\Captcha;
use think\facade\Config;

class Region extends BaseController
{

    /**
     * 获取省市区接口
     * @return void
     *
     */
    public function region_list()
    {
        // city_id作为parent_id
        $param['parent_id'] = Request::param('city_id/d', 0);

        try {
            validate(\app\validate\Region::class)->check([
                'parent_id' => $param['parent_id'],
            ]);
        } catch (ValidateException $e) {

            returnFail(21009, $e->getError());
        }
        $data = RegionService::region_list($param);
        returnSuccess(200, '获取成功', $data);

    }


}
